#include <bits/stdc++.h>
using namespace std;
#define int long long
int dp[105][105];
long long ans=0x3f3f3f3f3f3f3fll,n,m,a[105];
signed main() {
    freopen("sub.in","r",stdin);
    freopen("sub.out","w",stdout);
    cin>>n>>m;
    for(int i=1;i<=n;i++)cin>>a[i];
    for(int i=1;i<=n;i++){
        memset(dp,0x3f,sizeof(dp));
        dp[i][1]=0;
        //max(dpj,k-1,a_j+b_k)
        for(int j=i+1;j<=n;j++){
            for(int k=1;k<=m;k++){
                for(int l=i;l<j;l++){
                    dp[j][k]=min(max(dp[l][k-1],a[j]+a[l]),dp[j][k]);
                }
                
            }
            ans=min(ans,max(dp[j][m],a[i]+a[j]));
        }
    }
    cout<<ans<<'\n';
    return 0;
}